import React, { useState, useEffect } from 'react';
import styles from './index.less';

// loadjs文档：https://www.npmjs.com/package/loadjs

// 远程加载js （按需引入）
function loadCodemirror() {
  var urls = [
    'http://cdnjs.cloudflare.com/ajax/libs/diff_match_patch/20121119/diff_match_patch.js',
  ];

  loadjs(urls, {
    async: false,
    success: function() {
      console.log('加载完成');
    },
  });
}

export default class extends React.Component {
  componentDidMount = () => {
    setTimeout(() => {
      loadCodemirror();
    }, 2000);
  };
  render() {
    return <div className={styles.page}>loadjs</div>;
  }
}
